<?php
include_once(APP_LIB_DIR . 'BaseModel.class.php');
class DBIntegration extends BaseModel
{
	function main(){
		$old = $this->get_old();

		foreach($old as $d){
			//set to blank;
			$d['zzz'] ='';
			$sinfo['stud_no'] = $d['stud_no'];
			$sinfo['fname'] = $d['fname'];
			$sinfo['mname'] = $d['mname'];
			$sinfo['lname'] = $d['lname'];
			$sinfo['gender'] = $d['gender'];
			$sinfo['age'] = $d['age'];
			$sinfo['status'] = $d['status'];
			$sinfo['bdate'] = $d['bdate'];
			$sinfo['pbirth'] = $d['pbirth'];
			$sinfo['add_no'] = $d['zzz'];
			$sinfo['add_street'] = $d['zzz'];
			$sinfo['add_subdbrgy'] = $d['zzz'];
			$sinfo['add_townctry'] = $d['zzz'];
			$sinfo['add_zipcode'] = $d['zzz'];
			$sinfo['home_no'] = $d['homecontact'];
			$sinfo['mobile_no'] = $d['zzz'];
			$sinfo['religion'] = $d['zzz'];
			$sinfo['nationality'] = $d['zzz'];
			$sinfo['mother'] = $d['zzz'];
			$sinfo['mother_add'] = $d['zzz'];
			$sinfo['father'] = $d['zzz'];
			$sinfo['father_add'] = $d['zzz'];
			$sinfo['created_by'] = 'admin';
			$sinfo['creation_date'] = 'NOW()';
			$sinfo['active'] = 1;

			$this->insert('students', $sinfo);
			$s_id = $this->last_insert_id('students');

		}
	}

	function get_old(){
		$this->select_db('mcsghes');
		return $this->select_all("SELECT * FROM `stud_info`");
	}
}

$a = new DBIntegration('run');
$a->main();
?>
